package com.emagic.manage.data.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

public final class GainPointsQueue {

    private static class GainPointsQueueHolder {
        private static final GainPointsQueue INSTANCE = new GainPointsQueue();
    }

    public static GainPointsQueue getDefault() {
        return GainPointsQueueHolder.INSTANCE;
    }

    private AtomicBoolean mainActivityHasInit = new AtomicBoolean(false);
    private ArrayList<String> points = new ArrayList<>();


    public boolean mainActivityHasInit() {
        return mainActivityHasInit.get();
    }

    public void mainActivityInit() {
        mainActivityHasInit.set(true);
    }

    public void mainActivityUnInit() {
        mainActivityHasInit.set(false);
    }

    public void addPoint(String point) {
        points.add(point);
    }

    public List<String> getAndClean() {
        ArrayList<String> dataList = new ArrayList<>(points);
        points.clear();
        return dataList;
    }

    private GainPointsQueue() {
    }
}
